perm filename ELEPHA.XGP[W79,JMC] blob
sn#421075 filedate 1979-03-01 generic text, type T, neo UTF8
/LMAR=0/XLINE=3/FONT#0=BAXL30/FONT#1=BAXM30/FONT#2=BASB30/FONT#3=SUB/FONT#4=SUP/FONT#5=BASL35/FONT#6=NGR25/FONT#7=MATH30/FONT#8=FIX25/FONT#9=GRKB30
␈↓ α∧␈↓␈↓ u1
␈↓ α∧␈↓α␈↓ ∧/THE PROGRAMMING LANGUAGE ELEPHANT
␈↓ α∧␈↓␈↓ αTThe␈α
programming␈αlanguage␈α
Elephant␈α(it␈α
never␈αforgets)␈α
is␈αa␈α
sequential␈αlanguage␈α
(i.e.␈αbased
␈↓ α∧␈↓on␈α∂assignments).␈α∂ Its␈α∞statements␈α∂may␈α∂refer␈α∂to␈α∞the␈α∂past␈α∂of␈α∂the␈α∞computation.␈α∂ For␈α∂the␈α∂time␈α∞being,
␈↓ α∧␈↓consider it as an extension to the Lisp program feature. Thus statements may refer to
␈↓ α∧␈↓␈↓ αT1. x = 3 more recently than y = 9
␈↓ α∧␈↓␈↓ αT2. the value of x the last time y = 3
␈↓ α∧␈↓␈↓ αTSuch␈α⊂things␈α∂can␈α⊂be␈α⊂accomplished␈α∂by␈α⊂adding␈α∂to␈α⊂a␈α⊂simple␈α∂sequential␈α⊂language␈α⊂a␈α∂reserved
␈↓ α∧␈↓identifier␈αcalled␈α␈↓↓history␈↓.␈α Programs␈αcan␈αrefer␈αto␈α␈↓↓history␈↓␈αbut␈αcannot␈αassign␈αto␈αit.␈α ␈↓↓history␈↓␈αis␈αa␈αrecord
␈↓ α∧␈↓of␈α∂all␈α∂assignments␈α∂that␈α∞have␈α∂been␈α∂made,␈α∂i.e.␈α∞it␈α∂is␈α∂a␈α∂list␈α∞of␈α∂pairs␈α∂(<variable>.<value>),␈α∂and␈α∂it␈α∞is
␈↓ α∧␈↓updated␈αevery␈αtime␈αan␈αassignment␈αis␈αmade.␈α The␈αupdate␈αis␈αmade␈αby␈α␈↓↓cons␈↓ing␈αlatest␈αvariable-value
␈↓ α∧␈↓pair on the front of ␈↓↓history␈↓. Thus the statement
␈↓ α∧␈↓␈↓ αT␈↓↓x ← 3␈↓πx␈↓↓ + y;␈↓
␈↓ α∧␈↓would be equivalent to the pair of statements
␈↓ α∧␈↓␈↓ αT␈↓↓x ← 3␈↓πx␈↓↓ + y; history ← [X . x] . history␈↓;
␈↓ α∧␈↓in program feature Lisp.
␈↓ α∧␈↓␈↓ αTA␈α⊂good␈α⊂compiler␈α⊂for␈α∂Elephant␈α⊂will␈α⊂not␈α⊂generate␈α∂machine␈α⊂code␈α⊂that␈α⊂maintains␈α⊂an␈α∂actual
␈↓ α∧␈↓␈↓↓history␈↓␈α
variable,␈α
because␈α
its␈α
use␈α
would␈α
fill␈α
up␈α
storage␈α
rapidly␈α
and␈α
searching␈α
it␈α
would␈α
take␈α
excessive
␈↓ α∧␈↓time.␈α∩ Instead␈α∩the␈α∩compiler␈α∩will␈α∩cleverly␈α∩decide␈α∩what␈α∩information␈α∩must␈α∩actually␈α∩be␈α∩kept␈α⊃and
␈↓ α∧␈↓generate␈αcode␈αthat␈αrefers␈α
to␈αadditional␈αvariables,␈αarrays,␈αtrees␈α
and␈αlists␈αas␈αconvenient␈αand␈α
required
␈↓ α∧␈↓in␈α∞order␈α∂to␈α∞execute␈α∂the␈α∞Elephant␈α∂program.␈α∞ How␈α∞much␈α∂cleverness␈α∞is␈α∂required␈α∞and␈α∂whether␈α∞the
␈↓ α∧␈↓modes␈α∞of␈α∞reference␈α∂to␈α∞the␈α∞past␈α∂have␈α∞to␈α∞be␈α∞restricted␈α∂or␈α∞whether␈α∞the␈α∂compiler␈α∞has␈α∞to␈α∂be␈α∞helped
␈↓ α∧␈↓remain to be seen.
␈↓ α∧␈↓␈↓ αTLet us give a simple program in Elephant.
␈↓ α∧␈↓␈↓ αT␈↓↓prec(P1,P2,h) ← not ␈↓αn␈↓↓ h and not P2 ␈↓αa␈↓↓ h and (P1 ␈↓αa␈↓↓ h: or prec(P1,P2,␈↓αd␈↓↓ h)␈↓